package com.kt.uokos.yimo;

import java.util.*;

/**
 * @Description TODO
 * @ClassName test01
 * @Date 2021/12/25 下午9:43
 * @Author KangTao
 */

public class test01 {
    public static void main(String[] args) {
        System.out.println(dataYear().values());
    }


    public static Map<String, Object> dataYear (){
        Calendar instance = Calendar.getInstance(TimeZone.getTimeZone("GMT+08:00"));
        int startYear = instance.get(Calendar.YEAR);
        int endYear = instance.get(Calendar.YEAR)-10;
        List<Map<String,Object>> list = new ArrayList<>();
        for (int i = endYear ; i <= startYear ; i++) {
            HashMap<String, Object> map = new HashMap<>();
            map.put("year",String.valueOf(i));
            map.put("month",getMonthList());
            list.add(map);
        }
        HashMap<String, Object> map = new HashMap<>();
        map.put("dataYears",list);
        return map;
    }

    public static List<Map<String,Object>>  getMonthList(){

        List<Map<String,Object>> list = new ArrayList<>();

        for (int i = 1; i <=12 ; i++) {
            HashMap<String, Object> map = new HashMap<>();
            if (i <= 9){
                map.put("value",("0"+i));
            }else {
                map.put("value",String.valueOf(i));
            }
            list.add(map);
        }
        return list;
    }


}
